<page-header title="客户申领" [breadcrumb]="breadcrumb" [action]="action">
    <ng-template #breadcrumb>
        <ql-breadcrumb>
            <ql-breadcrumb-item>客户管理</ql-breadcrumb-item>
            <ql-breadcrumb-item>客户申领</ql-breadcrumb-item>
        </ql-breadcrumb>
    </ng-template>
    <ng-template #action>
        <ql-button type="primary" (click)="onCreate()">我要申领</ql-button>
    </ng-template>
</page-header>

<page-container>
    <data-form label-width="100px" [showReset]="false" [formGroup]="formGroup" (submit)="onRefresh()">
        <ql-form-item label="申领人姓名">
            <ql-input></ql-input>
        </ql-form-item>
        <ql-form-item label="申领状态">
            <ql-select>
                <ql-option *ngFor="let item of dictService.getDict('receive_state')" [label]="item.paramLabel" [value]="item.paramValue"></ql-option>
            </ql-select>
        </ql-form-item>
        <ql-form-item label="申请时间">
            <ql-date-picker> </ql-date-picker>
        </ql-form-item>
    </data-form>

    <data-table [model]="applyList">
        <!-- <ql-table-column model-key="customerno" label="客户号"> </ql-table-column>
        <ql-table-column model-key="customername" label="姓名"> </ql-table-column> -->
        <ql-table-column model-key="orgname" label="申领人所属机构"> </ql-table-column>
        <ql-table-column model-key="receivername" label="申领人姓名"> </ql-table-column>
        <ql-table-column model-key="reason" label="申领理由"> </ql-table-column>
        <ql-table-column model-key="receivestate" label="申领状态">
            <ng-template #slot let-scope="scope">
                {{scope.rowData.receivestate | dict:'receive_state'}}
            </ng-template>
        </ql-table-column>
        <ql-table-column model-key="receivetime" label="申领时间"></ql-table-column>
        <ql-table-column label="操作" width="100">
            <ng-template #slot let-scope="scope">
                <ql-button type="text" (click)="editApply(scope)">编辑</ql-button>
                <ql-button type="text" (click)="delApply(scope)">删除</ql-button>
            </ng-template>
        </ql-table-column>
    </data-table>

    <!-- 新增客户申领 -->
    <ng-template #addCustomerapply>
        <ql-form [inline]="true" ql-row label-width="100px" [formGroup]="formGroup">
            <!-- <ql-form-item ql-col span="12" label="客户姓名">
                <ql-input></ql-input>
            </ql-form-item>
            <ql-form-item ql-col span="12" label="客户主管机构">
                <ql-input></ql-input>
            </ql-form-item> -->
            <ql-form-item ql-col span="12" label="申领人名称">
                <ql-input formControlName="receiverName"></ql-input>
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领人机构">
                <ql-input formControlName="receiverOrgName"></ql-input>
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领时间">
                <ql-date-picker> </ql-date-picker>
                <!-- <ql-input formControlName="receiveTime"></ql-input> -->
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领原因">
                <ql-input formControlName="reason"></ql-input>
            </ql-form-item>
            <div ql-col="24" class="text-right">
                <ql-button style="width:120px" type="primary" (click)="submitApply()">申领</ql-button>
            </div>
        </ql-form>
    </ng-template>

    <!-- 修改客户申领 -->
    <ng-template #editCustomerapply>
        <ql-form [inline]="true" ql-row label-width="100px" [formGroup]="editformGroup">
            <ql-form-item ql-col span="12" label="申领人名称">
                <ql-input formControlName="receiverName"></ql-input>
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领人机构">
                <ql-input formControlName="receiverOrgName"></ql-input>
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领时间">
                <ql-date-picker formControlName="receiveTime"> </ql-date-picker>
                <!-- <ql-input formControlName="receiveTime"></ql-input> -->
            </ql-form-item>
            <ql-form-item ql-col span="12" label="申领原因">
                <ql-input formControlName="reason"></ql-input>
            </ql-form-item>
            <div ql-col="24" class="text-right">
                <ql-button style="width:120px" type="primary" (click)="editSumit()">提交</ql-button>
            </div>
        </ql-form>
    </ng-template>
</page-container>